package command;

import java.util.HashMap;
import java.util.Map;

import System_impl.ExitCommand;
import System_impl.HelpCommand;
import System_impl.LoginCommand;
import System_impl.SelectByCodeCommand;
import System_impl.SelectByIdCommand;
import System_impl.SelectByNameCommand;
import System_impl.WrongCommand;

public class SystemCommandFactory extends CommandFactory {

	private static Map<CommandCode, Command> commandMap = new HashMap<>();

	static {
		commandMap.put(CommandCode.EXIT, new ExitCommand());
		commandMap.put(CommandCode.HELP, new HelpCommand());
		commandMap.put(CommandCode.LOGIN, new LoginCommand());
		commandMap.put(CommandCode.SELECTBYID, new SelectByIdCommand());
		commandMap.put(CommandCode.SELECTBYCODE, new SelectByCodeCommand());
		commandMap.put(CommandCode.SELECTBYNAME, new SelectByNameCommand());
		commandMap.put(CommandCode.QUIT, new ExitCommand());
		commandMap.put(CommandCode.LIST, new WrongCommand());
		commandMap.put(CommandCode.ADD, new WrongCommand());
		commandMap.put(CommandCode.DELETE, new WrongCommand());
		commandMap.put(CommandCode.RESET, new WrongCommand());
		commandMap.put(CommandCode.UPDATE, new WrongCommand());
		commandMap.put(CommandCode.LOGOUT, new WrongCommand());
	}

	public Command buildCommand(CommandCode cmd) {
		Command comm = commandMap.get(cmd);
		return comm;
	}

}
